<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<IEnumerable<DomainModel.Entities.Comment>>" %>
<!-- cooments start -->
<ul class="event_comment">
    <% 
        // for the index of the comment
        int i = 1;
        foreach (var comment in Model)
        { %>
    <li>
        <div class="comment_header">
            <% Html.RenderPartial("UserInfo32", comment.User); %>
            <br class="clear" />
        </div>
        <div class="comment_body">
            <p>
                <span class="comment_number">Comment
                    <%=i %></span> @ <em>
                        <%=comment.DateCreated.ToString("dd/MM/yyyy HH:mm:ss") %></em> <span>
                            <%
                                // check whether the event was created by this user
                                var isAdmin = UserHelper.IsAdminUser();
                                if (UserHelper.IsCreatedByUserID(comment.UserID) || isAdmin)
                                {%>
                            <%if (isAdmin)
                              { %>
                            <%= Html.ActionLink("Delete", "CommentDelete", "Event", new { id = comment.CommentID }, null)%>
                            <%}
                              else
                              { %>
                            <%= Html.ActionLink("Delete", "CommentDelete", "Event", new { id = comment.CommentID }, null)%>
                            <%}
                                }%>
                        </span>
                <br />
                <%= comment.Content%>
            </p>
        </div>
    </li>
    <% 
        // for the index of the comment
        //http://stackoverflow.com/questions/43021/c-get-index-of-current-foreach-iteration
        i++;
        } %>
</ul>
<!-- cooments end -->
